# 使用指定的settings.xml运行Maven命令
# 使用方法: .\mvn-with-settings.ps1 [maven命令]
# 例如: .\mvn-with-settings.ps1 clean install

param(
    [Parameter(ValueFromRemainingArguments=$true)]
    [string[]]$MavenArgs
)

if ($MavenArgs.Count -eq 0) {
    Write-Host "使用方法: .\mvn-with-settings.ps1 [maven命令]" -ForegroundColor Yellow
    Write-Host "例如: .\mvn-with-settings.ps1 clean install" -ForegroundColor Yellow
    exit 1
}

$settingsPath = "E:\maven\settings.xml"

if (-not (Test-Path $settingsPath)) {
    Write-Host "错误: 找不到Maven配置文件 $settingsPath" -ForegroundColor Red
    exit 1
}

Write-Host "使用Maven配置文件: $settingsPath" -ForegroundColor Green
Write-Host "执行命令: mvn $($MavenArgs -join ' ')" -ForegroundColor Green

& mvn -s $settingsPath @MavenArgs 